[IA64] get guest os type
authorAlex Williamson <alex.williamson@hp.com>
Fri, 11 May 2007 19:15:53 +0000 (13:15 -0600)
committerAlex Williamson <alex.williamson@hp.com>
Fri, 11 May 2007 19:15:53 +0000 (13:15 -0600)
This patch is to use GFW ACPI_OSI to identify guest OS type.
When ACPI_OSI gets OS type, it writes to a reserved port a
special val. then XEN can know the guest OS type.

NB. Linux returns true both for _OSI(linux) and _OSI(windows)

Signed-off-by: Zhang Xin <xing.z.zhang@intel.com>
Signed-off-by: Anthony Xu <anthony.xu@intel.com>
xen/arch/ia64/vmx/mmio.c
xen/arch/ia64/vmx/vmx_init.c
xen/include/asm-ia64/vmx_platform.h

index 682d9877f212ab89a766c5b48d92e55869db79c8..30524937f83fd18885e0274c1be5330dcc1d6515 100644 (file)
@@ -188,6 +188,21 @@ int vmx_ide_pio_intercept(ioreq_t *p, u64 *val)
 
 #define TO_LEGACY_IO(pa)  (((pa)>>12<<2)|((pa)&0x3))
 
+const char * guest_os_name[] = {
+    "Unknown",
+    "Windows 2003 server",
+    "Linux",
+};
+
+static inline void set_os_type(VCPU *v, u64 type)
+{
+    if (type > OS_BASE && type < OS_END) {
+        v->domain->arch.vmx_platform.gos_type = type;
+        gdprintk(XENLOG_INFO, "Guest OS : %s\n", guest_os_name[type - OS_BASE]);
+    }
+}
+
+
 static void legacy_io_access(VCPU *vcpu, u64 pa, u64 *val, size_t s, int dir)
 {
     struct vcpu *v = current;
@@ -210,6 +225,11 @@ static void legacy_io_access(VCPU *vcpu, u64 pa, u64 *val, size_t s, int dir)
     p->df = 0;
 
     p->io_count++;
+    
+    if (dir == IOREQ_WRITE && p->addr == OS_TYPE_PORT) {
+        set_os_type(v, *val);
+        return;
+    }
 
     if (vmx_ide_pio_intercept(p, val))
         return;
index 3d463191e679afa86d9454b5bab0b3f62e07a7e7..d366926498b1524657c8102965be3ca6c9d61fee 100644 (file)
@@ -305,7 +305,8 @@ vmx_final_setup_guest(struct vcpu *v)
        v->arch.privregs = (mapped_regs_t *)vpd;
        vcpu_share_privregs_with_guest(v);
        vpd->vpd_low.virt_env_vaddr = vm_buffer;
-
+    
+       v->domain->arch.vmx_platform.gos_type = OS_UNKNOWN;
        /* Per-domain vTLB and vhpt implementation. Now vmx domain will stick
         * to this solution. Maybe it can be deferred until we know created
         * one as vmx domain */
index 87160b10cf6d2627cdd4fbcd6c467d4573a67dbc..e750cc63093a3543956d235343924cc4a7d161d1 100644 (file)
 #include <public/xen.h>
 #include <public/hvm/params.h>
 #include <asm/viosapic.h>
+
+
+/* Value of guest os type */
+#define OS_BASE     0xB0
+#define OS_UNKNOWN  0xB0
+#define OS_WINDOWS  0xB1
+#define OS_LINUX    0xB2
+#define OS_END      0xB3
+
+/* port guest Firmware use to indicate os type 
+ * this port is used to trigger SMI on x86,
+ * it is not used on ia64 */
+#define OS_TYPE_PORT    0xB2
+
 struct mmio_list;
 typedef struct virtual_platform_def {
+    unsigned long       gos_type;
     unsigned long       buffered_io_va;
     spinlock_t          buffered_io_lock;
     unsigned long       buffered_pio_va;